export let xiandu = {
    namespaced: true,
    state: {
        mc_data: {},
        cc_data: {},
        mc_flag:false
    },
    actions: {
        getMainClassifyData(store, data = {}) {
            axios.get("/xiandu/categories").then(({
                data
            }) => {
                store.commit("setMainClassifyData", data)
            });
        },
        getChildrenClassifyData(store, data = {}) {
            let url = "/xiandu/category/"+data.en_name;
            axios.get(url).then(({
                data
            }) => {
                store.commit("setChildrenClassifyData", data)
            });
        }
    },
    mutations: {
        setMainClassifyData(state, data) {
            state.mc_data = data;
            state.mc_flag = true;
        },
        setChildrenClassifyData(state, data) {
            state.cc_data = data;
        },
    }
}